<template>
	<div class="container">
		<h4>兄弟组件的值</h4>
		<ul>
			<li v-for="(message, index) in Messages" :key="message + index">
				{{ message }}
			</li>
		</ul>
	</div>
</template>

<script>
import { EventBus } from '../eventBus';

export default {
	created() {
		EventBus.$on('brother', this.handleEvent);
	},
	data() {
		return {
			Messages: [],
		};
	},
	methods: {
		handleEvent(data) {
			data && this.Messages.push(data);
		},
	},
};
</script>

<style scoped>
.container {
	width: 200px;
	height: 200px;
	background-color: aqua;
}
</style>
